import 'package:floor/floor.dart';

@entity
class MessageEntity {
  @primaryKey
  int? id;

  int? createAt;

  String? content;

  int? fromUserId;

  int? toUserId;

  int? messageType;

  int? contentType;

  String? url;

  bool? isRead;

  MessageEntity({this.id, this.createAt, this.content, this.fromUserId, this.toUserId,
      this.messageType, this.contentType,
      this.url, this.isRead});

  MessageEntity.fromJson(Map<String, dynamic> json) {
    content = json['content'];
    fromUserId = json['fromUserId'];
    toUserId = json['toUserId'];
    messageType = json['messageType'];
    contentType = json['contentType'];
    url = json['url'];
    createAt = json['createAt'];
    isRead = json['isRead'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['content'] = this.content;
    data['fromUserId'] = this.fromUserId;
    data['toUserId'] = this.toUserId;
    data['messageType'] = this.messageType;
    data['contentType'] = this.contentType;
    data['url'] = this.url;
    data['createAt'] = this.createAt;
    data['isRead'] = this.isRead;
    return data;
  }
}
